<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div></div>
    <div></div>
    <div></div>
    <script>
        // 声明一个数组
        const num = [1,2,3];

        // 声明一个函数
        function total(){
            console.log(arguments);
        }

        total(num);//arguments对象里只有一个元素:[1,2,3]
        total(...num)//arguments对象里有三个元素:1,2,3 | 等价于total(1,2,3)

        // 拓展运算符的运用：
        const shuzi = ['1','2','3'];
        const zimu = ['a','b','c'];
        // 1.数组的合并
        //ES5
        const hebing = shuzi.concat(zimu);
        console.log(hebing);//['1','2','3','a','b','c']
        //ES6 拓展运算符
        const hebing2 = [...shuzi,...zimu]
        console.log(hebing2);//['1','2','3','a','b','c']

        // 2.数组的克隆
        const a = ['q','w','e'];
        const b = [...a];//['q','w','e']  有引用数据类型注意是浅拷贝 没有完全复制
        console.log(b);

        // 3.伪数组转为真正的数组
        const divs = document.querySelectorAll('div');
        console.log(divs);//NodeList
        const divArr = [...divs];
        console.log(divArr);//[div, div, div]
    </script>
</body>
</html>